<?php

namespace App\Service\Adolescent;

use App\Model\AdolescentPassword;
use App\Service\BaseService;

class CheckAdolescentService extends BaseService
{
    /**
     * 确定是否打开青少年模式
     * @return int[]
     */
    public function handle(): array
    {
        $return = [
            'switch' => 1
        ];

        $userId = $this->getUserId();
        if (!$userId) {
            $return['switch'] = 0;
            return $return;
        }

        $adolescentPasswordModel = new AdolescentPassword();
        if ($adolescentPasswordModel->checkIsPassword($userId) == 1) {
            return $return;
        }

        $return['switch'] = 0;
        return $return;
    }
}